<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>上海泛软科技有限公司-后台登陆</title>
<meta name="robots" content="nofollow" />
<meta name=”viewport” content=”width=device-width, initial-scale=1, maximum-scale=1″>
<link href="/Public/Css/admin-style.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="/Public/Css/bootstrap.min.css" rel="stylesheet" type="text/css" />


<script language="javascript" type="text/javascript" src="/Public/Js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/admin-common.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.min.js"></script>
<!--<script language="javascript" type="text/javascript" src="/Public/Js/bootstrap.js"></script> -->
<script language="javascript" type="text/javascript" src="/Public/Js/rock_customer_list.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/demo.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/blob.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/FileSaver.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery.base64.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/jquery-1.10.2.min.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/tableExport.js"></script>
<script language="javascript" type="text/javascript" src="/Public/Js/xlsx.core.min.js"></script>
</head>

<body>

<style>
  #hedaer{
     background:#B9D3EE;
	 padding-left:0px;
	 background-color:rgba(185,211,238,0.15);
	 width:100%;
	 height:100px;
	 border-bottom: 1px solid #ccc;
	 overflow:hidden ;
	 padding-left:10px;
  }
  .select_Sty{
     float:left;
  }
   .select_Sty select {
   width: 150px;
   padding: 1px;
   font-size: 14px;
   border: 1px solid #ccc;
   height: 22px;
   margin-right:20px;
   border-radius:3px
}
 .select_Sty input {
   width: 150px;
   padding: 1px;
   font-size: 14px;
   border: 1px solid #ccc;
   height: 22px;
   margin-right:20px;
   border-radius:3px
}
 #content #boder{
    padding-left:10px;
	padding-right:10px;
   
 }
 body{
   background-color:rgba(232,232,232,0.25);
 }
 h5{
   font-size: 10px;
 }
 h4{
   margin-bottom:0px;
   font-size: 14px;
 }

</style>
<div id="background"> 
 
 <div id="hedaer">
   <h4 id = "fileName">体温报警</h4>
   <div class="select_Sty choose_Hos">
     <h5>所属医院:</h5>
    <select name="h_name" class="se">
	  <option value ="请选择">请选择</option>
	  <?php if(is_array($temper_hos)): $i = 0; $__LIST__ = $temper_hos;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$temper_hos): $mod = ($i % 2 );++$i;?><option value ="<?php echo ($temper_hos['name']); ?>"><?php echo ($temper_hos["name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?> 
    </select>
   </div>
   <div class="select_Sty last_Time">
    <h5>设备类型:</h5>
     <select  name="d_style" class="se">
	  <?php if(is_array($device_tyle)): $i = 0; $__LIST__ = $device_tyle;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$device_tyle): $mod = ($i % 2 );++$i;?><option  value ="<?php echo ($device_tyle['d_id']); ?>"><?php echo ($device_tyle['d_style']); ?></option><?php endforeach; endif; else: echo "" ;endif; ?> 
    </select>
   </div>
   <div class="select_Sty choose_Status">
     <h5>高温(体温):</h5>
      <input type="type"  id="temper" value=">=3%"></input>
   </div>
   
   <div id="search" style="margin-left:60px;margin-top:30px">
    <button type="button"  class="btn btn-primary btn-sm" onclick="search()">查询</button>
   </div>
 </div>   
 <div id="content">
   <div id="boder">
   <div id="items" style="width:90%;float:left;">
     <p><span id="cou"></span></p> 
   </div>
    <div style="width:10%;float:left;text-align:center">
		 <ul style="width:100%;text-align:right;float:left;font-weight:bold;padding:0px;margin:0px;">
		   
		   <!-- <li style="float:left;margin:2px;display:none"><a href="#" id="u_modify" data-toggle="modal" data-target="#myModal">编辑</a></li> -->
		   
		   <!-- <li style="float:left;margin:2px;display:none"><a id="user_delete" onclick="temper_delete()">删除</a></li> -->
		   <li  class="listd" "><a id="device_Export">导出</a></li>
		 </ul>
     </div>
	<table class="table table-bordered deviceTblae" style="background:white">
	  <thead style="background-color:rgba(232,232,232,0.35)">
		<tr>
		  <th style="text-align:left">编号</th>
		   <th style="text-align:right">报警时间</th>
		   <th style="text-align:left;color:red">体温(高温比例)</th>
		  <th style="text-align:left">省／市</th>
		  <th style="text-align:left">所属医院</th>
		  <th style="text-align:left">病人人数</th>
		  <th style="text-align:right;">状态</th>
		</tr>
	  </thead>
	  <tbody id="temperature_Alarm_Data2">
	      <tr>
	      	<td>003</td>
	      	<td>2017-03-09 16:00:00</td>
	      	<td>4%</td>
	      	<td>北京市</td>
	      	<td>北京朝阳医院</td>
	      	<td>110</td>
	      	<td>未处理</td>
	      </tr>
	      <tr>
	      	<td>002</td>
	      	<td>2017-03-09 16:00:00</td>
	      	<td>4%</td>
	      	<td>北京市</td>
	      	<td>北京朝阳医院</td>
	      	<td>110</td>
	      	<td>未处理</td>
	      </tr>
	      <tr>
	      	<td>001</td>
	      	<td>2017-03-09 16:00:00</td>
	      	<td>4%</td>
	      	<td>北京市</td>
	      	<td>北京朝阳医院</td>
	      	<td>110</td>
	      	<td>未处理</td>
	      </tr>
	  </tbody>
	</table>
   </div>
 </div>
</div>
<script>
  initData("init");
 //获取加载数据
 function initData(flag){
   $.ajax({
  	   url: '/javajy/index.php/Admin/Wenlian/temperature_Alarm_Data',
  	   type: 'POST',
 	   dataType: 'JSON',//here
	   data:{
		  str:flag
	   },
 	   success: function(data){
	   debugger;
		 var html=''
         for(var i = 0; i < data.length; i++){
          html+=		  
		   '<tr>'
		   +'<td style="text-align:center"><input d_id='+data[i]["d_id"]+' t_id = '+data[i]["t_id"]+' type="checkbox" class="choose"></input></td>'
		   +'<td style="text-align:left">'+data[i]["d_number"]+'</td>'
		   +'<td style="text-align:left">'+data[i]["d_name"]+'</td>'
		   +'<td style="text-align:left">'+data[i]["h_name"]+'</td>'
		   +'<td style="text-align:left">'+data[i]["d_style"]+'</td>'
		   +'<td style="text-align:left">'+data[i]["c"]+'</td>'
		   +'<td style="text-align:right">'+data[i]["maxT"]+'</td>'
		   +'<td style="text-align:right">'+data[i]["T"]+'</td> '
		   +'</tr>'
		 }
        document.getElementById("temperature_Alarm_Data").innerHTML = html;		
        document.getElementById("cou").innerHTML = data.length;		
		//单选
		  $(".choose").click(function(){
		   
		   var all_choose = $(".all_choose").is(':checked');
		   if(all_choose){
		  	  $(".all_choose").prop('checked',false);
			 }
		  });
	   }
	 });
  
 }
  //查找
  function search(){
    var arr = {};
    $(".se").each(function(){
	   var value = $(this).val();
	   if($(this).val()!="请选择"){
		 var name = $(this).attr("name");
		 var name1 = name.substr(0,1);
		 name = name1+"."+name;
		 arr[name] = value; 
	   }
	});
	var string = JSON.stringify(arr);//将数组转为json
	
	initData(string);
  }
   //全选
  $(".all_choose").click(function(){
     var flag = $(this).is(':checked');
	 if(flag){
	      $(".choose").each(function(){
		  $(this).prop('checked',true);
	    })
	 }else{
	    $(".choose").each(function(){
		  $(this).prop('checked',false);
	    })
	 }
  })
 //删除
 function temper_delete(){
  var len = $("input[type='checkbox']:checked").length;//删除用户的个数
	if(len == 0){
	   alert("请选择需要删除的用户");
	}else{
	  var u_arr = new Array();//
	  $(".choose").each(function(){
        var f_this = $(this).is(':checked');		
        if(f_this){
			u_arr.push($(this).attr("t_id"));
	     }		
	   })
      var string1 = JSON.stringify(u_arr);//将数组转为json
	  $.ajax({
  	    url: '/javajy/index.php/Admin/Wenlian/temperature_deleta',
  	    type: 'POST',
 	    dataType: 'JSON',//here
		data:{
		   destr:string1
		 },
 	     success: function(data){
		  alert(data);
		  location.reload(true);                                     
		 }
	   });
     }
 } 
//获取日期与时间
 function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
	var hours = date.getHours(); //获取当前小时数(0-23)
    var min =  date.getMinutes(); //获取当前分钟数(0-59)
    var second = date.getSeconds(); //获取当前秒数(0-59)
	
    if (month >= 1 && month <= 9) {
         month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
	if(hours >=0 && hours <= 9){
	   hours = "0" + hours;
	}
	if(min >=0 && min <= 9){
	   min = "0" + min;
	}
	if(second >=0 && second <= 9){
	   second = "0" + second;
	}
    var currentdate = year + seperator1 + month + seperator1 + strDate +" "+hours +"时" + min+"分" + second+"秒";
    return currentdate;
 } 
 //导出exce
 var exportData = document.getElementById("device_Export");
 exportData.onclick = function(){
    //$(".deviceTblae").tableExport({ type: 'excel', separator: ';', escape: 'false' });
	var fName = $("#fileName").html();
	var currentTime =  getNowFormatDate();
	fName = fName+'_'+currentTime;
	$(".deviceTblae").tableExport({ type: 'excel', separator: ',', escape: 'false',fileName:fName });
 }
</script>

</body>
</html>